import com.googlecode.proxymatic.apps.factory.FactoryBuilder;
import com.googlecode.proxymatic.apps.factory.ProxyFactoryBuilder;

public class Java14Demo {
    public static void main(String[] args) {
        FactoryBuilder factoryBuilder = new ProxyFactoryBuilder();
        IntegerFactory integerFactory = (IntegerFactory) factoryBuilder.createFactory(IntegerFactory.class);
        Integer integer = integerFactory.newInteger(42);
        if (integer.intValue() != 42) {
            throw new IllegalArgumentException(integer + " is wrong!");
        }
    }

    public interface IntegerFactory {
        Integer newInteger(int intValue);
    }
}